package org.imraniqbal.pacman;

import org.imraniqbal.engine.Item;
import org.imraniqbal.engine.Map;
import org.imraniqbal.engine.Mappable;

public class BigPill extends Item{
	
	/**
	 * Create a big pill and place it at the given X and Y
	 * @param x The x coordinate of the pill
	 * @param y The y coordinate of the pill
	 * @author imran
	 */
	public BigPill(int x, int y) {
		super(x, y);
	}
	
	/**
	 * Performs the action big pill is supposed to do, ie beastmode pacman
	 * @param obj Should be the instance of pacman
	 * @author imran
	 */
	@Override
	public void action(Object obj, Map map) {
		if(obj instanceof Pacman){
			((Pacman)obj).setState(PacmanState.BEASTMODE);
			map.removeMappable(this);
		}
	}
	/**
	 * @author imran
	 */
	@Override
	public boolean equals(Object obj){
		if(obj instanceof BigPill){
			return(((Mappable)obj).getX() == this.getX() && this.getY() == ((Mappable)obj).getY());
		}
		return false;
	}

}
